package hlhj.fhp.checkpoint.adp

import android.os.Build
import android.support.annotation.RequiresApi
import android.support.v7.widget.GridLayoutManager
import android.widget.LinearLayout
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.liaoinstan.springview.utils.DensityUtil
import hlhj.fhp.checkpoint.R
import hlhj.fhp.checkpoint.javaBean.LocationBean
import hlhj.fhp.checkpoint.javaBean.YearLimitBean

/**
 * Created by Never Fear   on 2018\11\8 0008.
Never More....
 */
class ChooseYearLocPopAdp(private val lists:ArrayList<YearLimitBean.InfoBean>)
    : BaseQuickAdapter<YearLimitBean.InfoBean, BaseViewHolder>(R.layout.pop_choose_item,lists) {
    @RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
    override fun convert(helper: BaseViewHolder?, item: YearLimitBean.InfoBean?) {
        helper?.setText(R.id.itemTv,item?.provinceSimple)


        val lo = helper?.itemView as LinearLayout
        val lp = lo.layoutParams as GridLayoutManager.LayoutParams

        when(helper?.adapterPosition%5){
            0->{
                lp.marginStart=0
                lp.marginEnd= DensityUtil.dip2px(mContext, 5f)
            }
            4->{
                lp.marginEnd=0
                lp.marginStart= DensityUtil.dip2px(mContext, 5f)
            }
            else->{
                lp.marginEnd= DensityUtil.dip2px(mContext, 5f)
                lp.marginStart= DensityUtil.dip2px(mContext, 5f)
            }
        }
//    lo.layoutParams=lp


    }

}